package music

import (
	"sync"
)

var (
	musicMUx sync.Mutex
)

func PlayMusic(path string) {
	musicMUx.Lock()
	defer musicMUx.Unlock()

	var nusicH MusicEntry
	nusicH.Source = path
	if err := nusicH.Open(); err != nil {
		//fmt.Println("err : ", err)
		return
	}
	nusicH.Play()

}

func PlayMusicWithReturn(path string) bool {
	musicMUx.Lock()
	defer musicMUx.Unlock()

	var nusicH MusicEntry
	nusicH.Source = path
	if nusicH.Open() != nil {
		return false
	}
	nusicH.Play()
	return true
}
